package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaResultados extends JFrame {
	private JPanel jPanel1;
	private JComboBox cboNivel;
	private JButton btnMostrar;
	private JLabel lblSeleccionNivel;
	private JTable tblListado;
	private JScrollPane jspListado;
	private JComboBox cboModalidad;
	private JLabel lblSeleccionModalidad;

	public VentanaResultados(){
		super("Resultados de las competencias");
		initGUI();
	}
	
	
	private void initGUI() {
		try {
			{
				jPanel1 = new JPanel();
				getContentPane().add(jPanel1, BorderLayout.CENTER);
				jPanel1.setLayout(null);
				{
					lblSeleccionModalidad = new JLabel();
					jPanel1.add(lblSeleccionModalidad);
					lblSeleccionModalidad.setText("Seleccione una Modalidad");
					lblSeleccionModalidad.setBounds(26, 18, 182, 15);
				}
				{
					
					cboModalidad = new JComboBox();
					jPanel1.add(cboModalidad);
					cboModalidad.setBounds(26, 45, 435, 22);
				}
				{
					jspListado = new JScrollPane();
					jPanel1.add(jspListado);
					jspListado.setBounds(31, 139, 525, 223);
					{
			
						tblListado = new JTable();
						jspListado.setViewportView(tblListado);
					}
				}
				{
					lblSeleccionNivel = new JLabel();
					jPanel1.add(lblSeleccionNivel);
					lblSeleccionNivel.setText("Seleccione un nivel");
					lblSeleccionNivel.setBounds(31, 79, 120, 15);
				}
				{
					
					cboNivel = new JComboBox();
					jPanel1.add(cboNivel);
					cboNivel.setBounds(31, 100, 270, 22);
				}
				{
					btnMostrar = new JButton();
					jPanel1.add(btnMostrar);
					btnMostrar.setText("Mostrar");
					btnMostrar.setBounds(337, 88, 96, 34);
				}
			}
			{
				this.setSize(578, 415);
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	

	public void agregarListener(ActionListener accion){
//	    this.cboModalidad.addActionListener(accion);
//	    this.cboNivel.addActionListener(accion);
	    this.btnMostrar.addActionListener(accion);
	}
	
	public void setListado(AbstractTableModel abstractTableModel){
		tblListado.setModel(abstractTableModel);
	}
	
	public void setComboModalidades(String [] modalidades){
		
		ComboBoxModel cmbTipoFiguraModel = new DefaultComboBoxModel(modalidades);
		this.cboModalidad.setModel(cmbTipoFiguraModel);
	}
	
	public void setComboNiveles(String [] Niveles){
		
		ComboBoxModel cmbTipoFiguraModel = new DefaultComboBoxModel(Niveles);
		this.cboNivel.setModel(cmbTipoFiguraModel);
	}

	public void mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public int getModalidad(){
		
		int valor=this.cboModalidad.getSelectedIndex();
		return valor;

	}
	
	public int getNivel(){
		
		int valor=this.cboNivel.getSelectedIndex();
		return valor;
	}
	
}
